package com.example.blogsystem.service;

import com.example.blogsystem.mapper.UserMapper;
import com.example.blogsystem.model.User;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

@Service
@Slf4j
public class UserService {
    @Autowired
    private UserMapper userMapper;
    public User getUserById(Integer id){
       return userMapper.queryUserById(id);
    }

    public User getUserByName(String name){
        return userMapper.queryUserByName(name);
    }

    public void insertUser(User user){
        //log.info("user:{}", user);
        userMapper.insertUser(user);
    }

    public void updateUser(User user) {
        userMapper.updateUser(user);
    }

    public User getUserByEmail(String email) {
        return userMapper.queryUserEmail(email);
    }

    public void updatePassword(User user) {
        userMapper.updatePassword(user);
    }
}
